<html xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui" >  

    <!--    <h:body>-->
    <ui:composition template="layout.xhtml">

        <ui:define name="corpo">
            <h:form id="index_form" acceptcharset="utf-8"> 
                <p:panel header="Principal - Distribuição">

                    <br/>
                    <h:panelGrid style="float: right;" columns="4">
                        <p:graphicImage url="/media/img/new.png" title="Nova Distribuição" /> <p:commandLink   value="Cadastrar" title="Cadastrar Distribuicao" actionListener="#{managerDistribuicao.redirect('criarDistribuicao.xhtml')}" update="@form"/>
                        <p:graphicImage url="/media/img/search.png" title="Pesquisar D"/><p:commandLink value="Pesquisar" title="Pesquisar Distribuicao" actionListener="#{managerVisualizarDistribuicao.redirect('buscarDistribuicao.xhtml')}" update="@form"/> 
                    </h:panelGrid>
                    <br/>
                    <br/>
                    <p:dataTable id="distribuicaoTable" var="d" value="#{managerVisualizarDistribuicao.lstDistribuicao}" 
                                 paginator="true" rows="5"
                                 paginatorPosition="bottom"
                                 paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink}"  
                                 rowsPerPageTemplate="5,10,15">   >  

                        <f:facet name="header">  
                            Distribuições Realizadas
                        </f:facet>
                            
                        <p:column style="width:400px;">  
                            <f:facet name="header" >   
                                Executante
                            </f:facet>  
                            <h:outputText value="#{d.executante.nome}"/>  
                        </p:column>
                        <p:column style="width:400px;">  
                            <f:facet name="header" >   
                                Recebedor
                            </f:facet>  
                            <h:outputText value="#{d.recebedor.nome}"/>
                        </p:column>
                        <p:column style="width:200px;">  
                            <f:facet name="header" >   
                                Data 
                            </f:facet>  
                            <h:outputText value="#{d.dataDistribuicao}">
                                <f:convertDateTime pattern="dd/MM/yyyy"/>
                            </h:outputText>
                                                 
                        </p:column>
                        <p:column style="width:80px;">  
                            <f:facet name="header">  
                                <h:outputText value="Opções" />   
                            </f:facet>
                            <p:commandButton  icon="editar"
                                              actionListener="#{managerEditarDistribuicao.redirect('editarDistribuicao.xhtml',d)}"
                                              update="@form"/> 
                            <p:commandButton  icon="view"
                                              actionListener="#{managerVisualizarDistribuicao.redirect('visualizarDistribuicao.xhtml', d)}" 
                                              update="@form"/>   

                        </p:column>
                       </p:dataTable> 

                </p:panel>
            </h:form>
        </ui:define>
    </ui:composition>
</html>